<template>
     <div>
         <!-- {{$store.state.ModuleA.age}} -->
         {{age}}
         <button @click="setAge">修改age</button>
         {{arr}}
     </div>
</template>

<script>
import {mapState,mapMutations,mapActions} from "vuex"
// mapstate,mapgetters写在computed里
// mapAction，mapMution写在methods
export default {
    computed:{
       ...mapState({
           age:state=>state.ModuleA.age,
           arr:state=>state.ModuleA.arr
           // 要取得数据名：state=>state.模块名.要取的数据
       })
    },
    methods:{
        ...mapMutations({
            setAag:"ModuleA/setAag"
            // 仓库里的方法名："模块名/方法名""
        }),
        ...mapActions({
            getList:"ModuleA/getList"
        }),
        setAge(){
            this.setAag(60)
        }
    },
    mounted() {
        console.log(this.$store.state.ModuleA.age);
        this.getList()
    }
}
</script>

<style>

</style>